%                **** IMPORTANT NOTICE *****
% This LaTeX file has been automatically produced by ProTeX v. 1.1
% Any changes made to this file will likely be lost next time
% this file is regenerated from its source. Send questions 
% to Arlindo da Silva, dasilva@gsfc.nasa.gov
 
\parskip        0pt
\parindent      0pt
\baselineskip  11pt
 
%--------------------- SHORT-HAND MACROS ----------------------
\def\bv{\begin{verbatim}}
\def\ev{\end{verbatim}}
\def\be{\begin{equation}}
\def\ee{\end{equation}}
\def\bea{\begin{eqnarray}}
\def\eea{\end{eqnarray}}
\def\bi{\begin{itemize}}
\def\ei{\end{itemize}}
\def\bn{\begin{enumerate}}
\def\en{\end{enumerate}}
\def\bd{\begin{description}}
\def\ed{\end{description}}
\def\({\left (}
\def\){\right )}
\def\[{\left [}
\def\]{\right ]}
\def\<{\left  \langle}
\def\>{\right \rangle}
\def\cI{{\cal I}}
\def\diag{\mathop{\rm diag}}
\def\tr{\mathop{\rm tr}}
%-------------------------------------------------------------

\markboth{Left}{Source File: date.F,  Date: Thu Mar 22 01:00:12 MST 2001
}

 
%/////////////////////////////////////////////////////////////

  \subsubsection{date\_set\_calendar}


                              
   
\bigskip{\sf INTERFACE:}
\begin{verbatim}       subroutine date_set_calendar ( type )
 \end{verbatim}{\em USES:}
\begin{verbatim}       none
 \end{verbatim}{\em INPUT PARAMETERS:}
\begin{verbatim}       implicit NONE
 
       integer, intent(in) :: type           ! Calendar type (e.g. NO_LEAP)
 \end{verbatim}{\em OUTPUT PARAMETERS:}
\begin{verbatim}        none
 \end{verbatim}
{\sf DESCRIPTION:\\ }


  
   Specifies the calendar to be used in date calculations.  Valid values
   of {\tt type} are given by the integer parameters that identify calendars.
  
\bigskip{\sf REVISION HISTORY:}
\begin{verbatim}    Feb 8, 2001    B. Eaton   Specification.\end{verbatim}
 
%/////////////////////////////////////////////////////////////
 
\mbox{}\hrulefill\ 
 

  \subsubsection{date\_set}


   
\bigskip{\sf INTERFACE:}
\begin{verbatim}       function date_set ( yearmmdd, tod )
 \end{verbatim}{\em USES:}
\begin{verbatim} 
       none
 \end{verbatim}{\em INPUT PARAMETERS:}
\begin{verbatim}       implicit NONE
 
       integer, intent(in) :: yearmmdd       ! Date
       integer, intent(in), optional :: tod  ! Time of day
 \end{verbatim}{\em OUTPUT PARAMETERS:}
\begin{verbatim}       type(date_t) :: set_date              ! Returned date
 \end{verbatim}
{\sf DESCRIPTION:\\ }


  
   Returns the date specified by {\tt yearmmdd} and optionally {\tt tod}.  
   If {\tt tod} is not specified then 0Z is assumed.
  
\bigskip{\sf REVISION HISTORY:}
\begin{verbatim}    Feb 8, 2001    B. Eaton   Specification.\end{verbatim}
 
%/////////////////////////////////////////////////////////////
 
\mbox{}\hrulefill\ 
 

  \subsubsection{date\_get}


   
\bigskip{\sf INTERFACE:}
\begin{verbatim}       subroutine date_get ( date, yearmmdd, tod )
 \end{verbatim}{\em USES:}
\begin{verbatim} 
       none
 \end{verbatim}{\em INPUT PARAMETERS:}
\begin{verbatim}       implicit NONE
 
       type(date_t), intent(in) :: date      ! Input date
 \end{verbatim}{\em OUTPUT PARAMETERS:}
\begin{verbatim}       integer, intent(out) :: yearmmdd      ! Returned date
       integer, intent(out) :: tod           ! Returned time of day
 \end{verbatim}
{\sf DESCRIPTION:\\ }


  
   Returns the attributes of {\tt date} in the form of {\tt yearmmdd}
   and {\tt tod}.  
  
\bigskip{\sf REVISION HISTORY:}
\begin{verbatim}    Feb 8, 2001    B. Eaton   Specification.\end{verbatim}
 
%/////////////////////////////////////////////////////////////
 
\mbox{}\hrulefill\ 
 

  \subsubsection{date\_to\_str}


   
\bigskip{\sf INTERFACE:}
\begin{verbatim}       function date_to_str ( date )
 \end{verbatim}{\em USES:}
\begin{verbatim} 
       none
 \end{verbatim}{\em INPUT PARAMETERS:}
\begin{verbatim}       implicit NONE
 
       type(date_t), intent(in) :: date      ! Input date
 \end{verbatim}{\em OUTPUT PARAMETERS:}
\begin{verbatim}       character (len=32) :: date_to_str     ! Returned string
 \end{verbatim}
{\sf DESCRIPTION:\\ }


  
   Returns {\tt} date in a string with the format "year-mm-dd hh:mm:ss".
  
\bigskip{\sf REVISION HISTORY:}
\begin{verbatim}    Feb 8, 2001    B. Eaton   Specification.\end{verbatim}
 
%/////////////////////////////////////////////////////////////
 
\mbox{}\hrulefill\ 
 

  \subsubsection{date\_increment}


   
\bigskip{\sf INTERFACE:}
\begin{verbatim}       function date_increment ( date, time )
 \end{verbatim}{\em USES:}
\begin{verbatim} 
       none
 \end{verbatim}{\em INPUT PARAMETERS:}
\begin{verbatim}       implicit NONE
 
       type(date_t), intent(in) :: date      ! Initial date
       type(time_t), intent(in) :: time      ! Time increment
 \end{verbatim}{\em OUTPUT PARAMETERS:}
\begin{verbatim}       type(date_t) :: date_increment        ! Returned date
 \end{verbatim}
{\sf DESCRIPTION:\\ }


  
   Increments a {\tt date} by a {\tt time} and returns the
   new value of {\tt date}.
  
\bigskip{\sf REVISION HISTORY:}
\begin{verbatim}    Feb 8, 2001    B. Eaton   Specification.\end{verbatim}
 
%/////////////////////////////////////////////////////////////
 
\mbox{}\hrulefill\ 
 

  \subsubsection{date\_increment\_sec}


   
\bigskip{\sf INTERFACE:}
\begin{verbatim}       function date_increment_sec ( date, nsec )
 \end{verbatim}{\em USES:}
\begin{verbatim} 
       none
 \end{verbatim}{\em INPUT PARAMETERS:}
\begin{verbatim}       implicit NONE
 
       type(date_t), intent(in) :: date      ! Initial date
       integer, intent(in) :: nsec           ! Time increment in seconds
 \end{verbatim}{\em OUTPUT PARAMETERS:}
\begin{verbatim}       type(date_t) :: date_increment_sec    ! Returned date
 \end{verbatim}
{\sf DESCRIPTION:\\ }


  
   Increments a {\tt date} by {\tt nsec} and returns the
   new value of {\tt date}.
  
\bigskip{\sf REVISION HISTORY:}
\begin{verbatim}    Feb 8, 2001    B. Eaton   Specification.\end{verbatim}
 
%/////////////////////////////////////////////////////////////
 
\mbox{}\hrulefill\ 
 

  \subsubsection{date\_increment\_day}


   
\bigskip{\sf INTERFACE:}
\begin{verbatim}       function date_increment_day ( date, nday )
 \end{verbatim}{\em USES:}
\begin{verbatim} 
       none
 \end{verbatim}{\em INPUT PARAMETERS:}
\begin{verbatim}       implicit NONE
 
       type(date_t), intent(in) :: date      ! Initial date
       integer, intent(in) :: nday           ! Time increment in days
 \end{verbatim}{\em OUTPUT PARAMETERS:}
\begin{verbatim}       type(date_t) :: date_increment        ! Returned date
 \end{verbatim}
{\sf DESCRIPTION:\\ }


  
   Increments a {\tt date} by {\tt nday} and returns the
   new value of {\tt date}.
  
\bigskip{\sf REVISION HISTORY:}
\begin{verbatim}    Feb 8, 2001    B. Eaton   Specification.\end{verbatim}
 
%/////////////////////////////////////////////////////////////
 
\mbox{}\hrulefill\ 
 

  \subsubsection{date\_increment\_month}


   
\bigskip{\sf INTERFACE:}
\begin{verbatim}       function date_increment_month ( date, nmon )
 \end{verbatim}{\em USES:}
\begin{verbatim} 
       none
 \end{verbatim}{\em INPUT PARAMETERS:}
\begin{verbatim}       implicit NONE
 
       type(date_t), intent(in) :: date      ! Initial date
       integer, intent(in) :: nmon           ! Time increment in months
 \end{verbatim}{\em OUTPUT PARAMETERS:}
\begin{verbatim}       type(date_t) :: date_increment        ! Returned date
 \end{verbatim}
{\sf DESCRIPTION:\\ }


  
   Increments a {\tt date} by {\tt nmon} and returns the
   new value of {\tt date}.
  
   Incrementing a date by months only changes the year and month unless the 
   day of month in the final month doesn't exist. In this case the closest day 
   that does exist is used. E.g., 31 Jan 2000 + 1 month = 29 Feb 2000. But note 
   that 28 Feb 2001 + 1 month = 28 Mar 2001, i.e., end of month days are not 
   preserved by adding months.
  
\bigskip{\sf REVISION HISTORY:}
\begin{verbatim}    Feb 8, 2001    B. Eaton   Specification.\end{verbatim}
 
%/////////////////////////////////////////////////////////////
 
\mbox{}\hrulefill\ 
 

  \subsubsection{date\_increment\_year}


   
\bigskip{\sf INTERFACE:}
\begin{verbatim}       function date_increment_year ( date, nyr )
 \end{verbatim}{\em USES:}
\begin{verbatim} 
       none
 \end{verbatim}{\em INPUT PARAMETERS:}
\begin{verbatim}       implicit NONE
 
       type(date_t), intent(in) :: date      ! Initial date
       integer, intent(in) :: nyr            ! Time increment in years
 \end{verbatim}{\em OUTPUT PARAMETERS:}
\begin{verbatim}       type(date_t) :: date_increment_year   ! Returned date
 \end{verbatim}
{\sf DESCRIPTION:\\ }


  
   Increments a {\tt date} by {\tt nyr} and returns the
   new value of {\tt date}.
  
   Incrementing a date by years only changes the year, unless the initial 
   date falls on a day of the month that doesn't exist in the final year. In 
   this case the final month will remain unchanged and the final day of the 
   month will be the closest day that does exist: e.g., 29 Feb 2000 + 1 year 
   is 28 Feb 2001.
  
\bigskip{\sf REVISION HISTORY:}
\begin{verbatim}    Feb 8, 2001    B. Eaton   Specification.\end{verbatim}
 
%/////////////////////////////////////////////////////////////
 
\mbox{}\hrulefill\ 
 

  \subsubsection{date\_decrement}


   
\bigskip{\sf INTERFACE:}
\begin{verbatim}       function date_decrement ( date, time )
 \end{verbatim}{\em USES:}
\begin{verbatim} 
       none
 \end{verbatim}{\em INPUT PARAMETERS:}
\begin{verbatim}       implicit NONE
 
       type(date_t), intent(in) :: date      ! Initial date
       type(time_t), intent(in) :: time      ! Time decrement
 \end{verbatim}{\em OUTPUT PARAMETERS:}
\begin{verbatim}       type(date_t) :: date_increment        ! Returned date
 \end{verbatim}
{\sf DESCRIPTION:\\ }


  
   Decrements a {\tt date} by a {\tt time} and returns the
   new value of {\tt date}.
  
\bigskip{\sf REVISION HISTORY:}
\begin{verbatim}    Feb 8, 2001    B. Eaton   Specification.\end{verbatim}
 
%/////////////////////////////////////////////////////////////
 
\mbox{}\hrulefill\ 
 

  \subsubsection{date\_diff}


   
\bigskip{\sf INTERFACE:}
\begin{verbatim}       subroutine date_diff ( date1, date2, time, islater )
 \end{verbatim}{\em USES:}
\begin{verbatim} 
       none
 \end{verbatim}{\em INPUT PARAMETERS:}
\begin{verbatim}       implicit NONE
 
       type(date_t), intent(in) :: date1     ! First date
       type(date_t), intent(in) :: date2     ! Second date
 \end{verbatim}{\em OUTPUT PARAMETERS:}
\begin{verbatim}       type(time_t), intent(out) :: time     ! Time difference
       logical, intent(out) :: islater       ! Difference flag
 \end{verbatim}
{\sf DESCRIPTION:\\ }


  
   Returns the difference ({\tt date1 - date2}) as a time interval (always positive)
   and a flag {\tt islater} which is true only if {\tt date1} is later than {\tt date2}.
  
\bigskip{\sf REVISION HISTORY:}
\begin{verbatim}    Feb 8, 2001    B. Eaton   Specification.\end{verbatim}
 
%/////////////////////////////////////////////////////////////
 
\mbox{}\hrulefill\ 
 

  \subsubsection{date\_diff\_days}


   
\bigskip{\sf INTERFACE:}
\begin{verbatim}       function date_diff_days ( date1, date2 )
 \end{verbatim}{\em USES:}
\begin{verbatim} 
       none
 \end{verbatim}{\em INPUT PARAMETERS:}
\begin{verbatim}       implicit NONE
 
       type(date_t), intent(in) :: date1      ! First date
       type(date_t), intent(in) :: date2      ! Second date
 \end{verbatim}{\em OUTPUT PARAMETERS:}
\begin{verbatim}       real(r8) :: date_diff_days        ! Returned date
 \end{verbatim}
{\sf DESCRIPTION:\\ }


  
   Returns the difference ({\tt date1 - date2}) as a floating point number of
   days.  This difference is negative if {\tt date2} is later than {\tt date1}.
  
\bigskip{\sf REVISION HISTORY:}
\begin{verbatim}    Feb 8, 2001    B. Eaton   Specification.\end{verbatim}
 
%/////////////////////////////////////////////////////////////
 
\mbox{}\hrulefill\ 
 

  \subsubsection{date\_calendar\_day}


   
\bigskip{\sf INTERFACE:}
\begin{verbatim}       function date_calendar_day ( date )
 \end{verbatim}{\em USES:}
\begin{verbatim} 
       none
 \end{verbatim}{\em INPUT PARAMETERS:}
\begin{verbatim}       implicit NONE
 
       type(date_t), intent(in) :: date      ! Input date
 \end{verbatim}{\em OUTPUT PARAMETERS:}
\begin{verbatim}       real(r8) :: calendar_day              ! Returned calendar day
 \end{verbatim}
{\sf DESCRIPTION:\\ }


  
   Returns the calendar day corresponding to {\tt date}.
  
\bigskip{\sf REVISION HISTORY:}
\begin{verbatim}    Feb 8, 2001    B. Eaton   Specification.\end{verbatim}

%...............................................................
